
//---------------------------------------------------------------------------
#include "testGame.h"
#include "renderer.h"
//---------------------------------------------------------------------------
using namespace test;
//---------------------------------------------------------------------------
bool TestGame::init (ns::Renderer& rkRenderer,DirectInput& dInput)
{
	base = new Node();
	renderer = &rkRenderer;
	input = &dInput;
	camera = new Camera(renderer);
	spider = new Model("../tanque4.3ds", &rkRenderer,base);

	//base->SetPosZ(10);
	//base->SetPosY(-5);
	//base->SetRotX(90);
	//base->SetRotX(90);
	//base->SetScaleX(0.01f);
	//base->SetScaleY(0.01f);
	//base->SetScaleZ(0.01f);

	return true;
}
//---------------------------------------------------------------------------
void TestGame::frame (ns::Renderer& rkRenderer)
{

/*	base->SetPosY( base->GetPosY() + 0.01f);
	if( base->GetPosY() > 1.0f) {
		base->SetPosY(-5);
	}*/
	base->UpdateTransformation();
	base->Draw();

	//------------------------INPUT------------------------------------
	input->reacquire();

	if(input->keyDown(ns::Input::KEY_W)){
		camera->Walk(0.001f);
	}
	if(input->keyDown(ns::Input::KEY_S)){
		camera->Walk(-0.001f);
	}
	if(input->keyDown(ns::Input::KEY_D)){
		camera->Strafe(0.001f);
	}
	if(input->keyDown(ns::Input::KEY_A)){
		camera->Strafe(-0.001f);
	}

	if(input->keyDown(ns::Input::KEY_SPACE)){
		camera->Jump(0.001f);
	}
	if(input->keyDown(ns::Input::KEY_LCONTROL)){
		camera->Jump(-0.001f);
	}
	
	camera->Pitch(input->mouseRelPosY()*0.001f);
	camera->Yaw(input->mouseRelPosX()*0.001f);
	camera->UpdateCam();
}
//---------------------------------------------------------------------------
void TestGame::deinit ()
{

}
//---------------------------------------------------------------------------
